﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ThanhTu.GNC.Media.KQXS.DataAccess.BL;
using ThanhTu.GNC.Media.KQXS.DataAccess.DO;
using System.Data;

namespace GNCMedia.KQXS.MenuPage
{
    public partial class Thongke_2socuoi_dacbiet_thang : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                for (int i = 2007; i <= 2024; i++)
                {
                    drl_tkdacbiet_begin_year_2socuoi.Items.Add(i.ToString());
                    drl_tkdacbiet_end_year_2socuoi.Items.Add(i.ToString());
                }

                ProvinceBL vProvince = new ProvinceBL();
                List<ProvinceDO> alldata = vProvince.selectadd();

                drl_tkdacbiet_region_2socuoi.DataSource = alldata;
                drl_tkdacbiet_region_2socuoi.DataTextField = "princeName";
                drl_tkdacbiet_region_2socuoi.DataValueField = "provinceID";
                drl_tkdacbiet_region_2socuoi.DataBind();

            }
        }

        protected void ImageButton_xemtiep_2socuoi_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                ResultLotteryBL vResult = new ResultLotteryBL();
                int rowcount = 0;
                int rowcount1 = 0;
                int rowcount2 = 0;
                int rowcount3 = 0;

                int chooseyear = Convert.ToInt32(drl_tkdacbiet_begin_year_2socuoi.SelectedItem.ToString());
                lb_nam_thongke_2socuoi_2014.Text = drl_tkdacbiet_begin_year_2socuoi.SelectedItem.ToString();
                string chooseyear_pre1 = Convert.ToString(chooseyear - 1);
                lb_nam_thongke_2socuoi_2013.Text = chooseyear_pre1;
                string chooseyear_pre2 = Convert.ToString(chooseyear - 2);
                lb_nam_thongke_2socuoi_2012.Text = chooseyear_pre2;
                string chooseyear_pre3 = Convert.ToString(chooseyear - 3);
                lb_nam_thongke_2socuoi_2011.Text = chooseyear_pre3;
                DataTable dt = vResult.Statistic_Spec_Month_2(drl_tkdacbiet_region_2socuoi.SelectedValue, drl_tkdacbiet_begin_year_2socuoi.SelectedItem.Text, 1, 31, ref rowcount);
                rpt_result_dacbiet_2socuoi.DataSource = dt;
                rpt_result_dacbiet_2socuoi.DataBind();

                DataTable dt1 = vResult.Statistic_Spec_Month_2(drl_tkdacbiet_region_2socuoi.SelectedValue, chooseyear_pre1, 1, 31, ref rowcount1);
                rpt_result_dacbiet_2socuoi_lui1.DataSource = dt1;
                rpt_result_dacbiet_2socuoi_lui1.DataBind();

                DataTable dt2 = vResult.Statistic_Spec_Month_2(drl_tkdacbiet_region_2socuoi.SelectedValue, chooseyear_pre2, 1, 31, ref rowcount2);
                rpt_result_dacbiet_2socuoi_lui2.DataSource = dt2;
                rpt_result_dacbiet_2socuoi_lui2.DataBind();

                DataTable dt3 = vResult.Statistic_Spec_Month_2(drl_tkdacbiet_region_2socuoi.SelectedValue, chooseyear_pre3, 1, 31, ref rowcount3);
                rpt_result_dacbiet_2socuoi_lui3.DataSource = dt3;
                rpt_result_dacbiet_2socuoi_lui3.DataBind();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {

            }
            
        }
    }
}